/**
 * 
 */
package com.devmindset.legoframework.client.mvc.metadata;

import com.devmindset.legoframework.client.mvc.LegoComponent;

/**
 * {@link Story} for a {@link LegoComponent}.
 * 
 * @author <a href="mailto:ice.penov@devmindset.com">Ice Penov</a>
 */
public class ComponentStory implements Story {
  
  private Enum<?> constructedBy;
  private String knownAs;
  
  /**
   * Constructor. 
   */
  ComponentStory() {}

  /**
   * Returns the constructedBy.
   *
   * @return the constructedBy
   */
  public Enum<?> getConstructedBy() {
    return constructedBy;
  }

  /**
   * Chaining setter for constructedBy.
   *
   * @param constructedBy the constructedBy to set
   * @return this instance
   */
  public ComponentStory constructedBy(Enum<?> constructedBy) {
    this.constructedBy = constructedBy;
    return this;
  }

  /**
   * Returns the knownAs.
   *
   * @return the knownAs
   */
  public String getKnownAs() {
    return knownAs;
  }

  /**
   * Chaining setter for the knownAs.
   *
   * @param knownAs the knownAs to set
   * @return this instance
   */
  public ComponentStory knownAs(String knownAs) {
    this.knownAs = knownAs;
    return this;
  }
  
  /**
   * {@inheritDoc}
   */
  @Override
  public String toString() {
    if (knownAs != null) {
      return knownAs;
    } else {
      super.toString();
    }
    return knownAs + constructedBy;
  }
  
}